<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta http-equiv="Cache-Control" content="no-siteapp">
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
  <meta name="renderer" content="webkit">

  
  <title>Android10源码刷入Pixel2以及整合GMS | 龙之叶的博客</title>

  <link rel="shortcut icon" href="/images/favicon.png">
  <link rel="alternate" href="/atom.xml" title="龙之叶的博客" type="application/atom+xml">
  <meta name="description" content="Android10源码刷入Pixel2以及整合GMS">
<meta property="og:type" content="article">
<meta property="og:title" content="Android10源码刷入Pixel2以及整合GMS">
<meta property="og:url" content="http://longzhiye.top/2023/08/27/2023-08-27/index.html">
<meta property="og:site_name" content="龙之叶的博客">
<meta property="og:description" content="Android10源码刷入Pixel2以及整合GMS">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://longzhiye.top/images/20230827/20230827150006.png">
<meta property="og:image" content="http://longzhiye.top/images/20230827/202308271401001.jpg">
<meta property="og:image" content="http://longzhiye.top/images/20230827/20230827T07-34-57.146Z.png">
<meta property="og:image" content="http://longzhiye.top/images/20230827/202308271401002.jpg">
<meta property="og:image" content="http://longzhiye.top/images/20230827/202308271401003.jpg">
<meta property="og:image" content="http://longzhiye.top/images/20230827/202308271401004.jpg">
<meta property="og:image" content="http://longzhiye.top/images/20230827/20230831150007.jpg">
<meta property="og:image" content="http://longzhiye.top/images/20230827/202308271401005.jpg">
<meta property="article:published_time" content="2023-08-26T16:00:00.000Z">
<meta property="article:modified_time" content="2024-08-29T02:40:34.908Z">
<meta property="article:author" content="龙之叶">
<meta property="article:tag" content="Android">
<meta property="article:tag" content="Linux">
<meta property="article:tag" content="Ubuntu">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://longzhiye.top/images/20230827/20230827150006.png">

  <meta name="keywords" content=",Android,Linux,Ubuntu">
  <meta name="format-detection" content="telephone=no,email=no">
  <meta name="theme-color" content="#9C27B0">

  <meta name="mobile-web-app-capable" content="yes">
  <meta name="application-name" content="龙之叶的博客">
  <meta name="msapplication-starturl" content="http://longzhiye.top/2023/08/27/2023-08-27/">
  <meta name="msapplication-navbutton-color" content="#9C27B0">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-title" content="龙之叶的博客">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <link rel="apple-touch-icon" href="/images/favicon.png">

  
    <link rel="canonical" href="http://longzhiye.top/2023/08/27/2023-08-27/">
  

  
  

  
  
  

  
<link rel="stylesheet" href="/css/mdui.css">
<link rel="stylesheet" href="/css/style.css">

  
<link rel="stylesheet" href="/custom.css">

<meta name="generator" content="Hexo 5.4.2"></head>

<body class="mdui-appbar-with-toolbar mdui-theme-primary-indigo mdui-theme-accent-pink">
  <script>var a=localStorage.getItem("mdui-theme-layout-dark");if(a){document.getElementsByTagName("body")[0].className+=" mdui-theme-layout-dark"};</script>
  <script>if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches){document.getElementsByTagName("body")[0].className+=" mdui-theme-layout-dark"};</script>
  <script>var a=localStorage.getItem("mdui-drawer-close");if(!a){document.getElementsByTagName("body")[0].className+=" mdui-drawer-body-left"};</script>
  <header id="header" class="mdui-appbar mdui-appbar-fixed mdui-appbar-scroll-hide mdui-appbar-inset">
  <div class="mdui-toolbar mdui-color-theme">
    <a href="javascript:;" class="mdui-btn mdui-btn-icon" mdui-drawer="{target: '#sidebar', swipe: true}"><i class="mdui-icon material-icons">menu</i></a>
    <a href="/" class="mdui-typo-headline">龙之叶的博客</a>
    <div class="mdui-toolbar-spacer"></div>
    <a href="javascript:;" class="mdui-btn mdui-btn-icon" mdui-dialog="{target: '#search'}" mdui-tooltip="{content: '搜索'}"><i class="mdui-icon material-icons">search</i></a>
	<!--
    <a href="/atom.xml" class="mdui-btn mdui-btn-icon" mdui-tooltip="{content: 'RSS'}"><i class="mdui-icon material-icons">rss_feed</i></a>
	-->
  </div>
</header>
<div class="mdui-dialog" id="search">
  
    <div class="search-form">
      <input type="search" class="search-form-input" placeholder="请输入关键字">
    </div>
    <div class="search-result" data-resource="/search.xml"></div>
  
</div>

  <aside id="sidebar" class="mdui-drawer mdui-drawer-full-height">
  <script>var a=localStorage.getItem("mdui-drawer-close");if(a){document.getElementById("sidebar").className+=" mdui-drawer-close"};</script>
  <div class="mdui-grid-tile">
    <img src="/images/banner.png" style="height: 160px;">
    <img src="/images/avatar.png" class="avatar-animation" style="position: absolute; top: 10%; left: 24px; width: 64px; height: 64px; border: 2px solid #fff; border-radius: 50%;background-color:#fff;">
    <div class="mdui-grid-tile-actions">
      <div class="mdui-grid-tile-text">
        <div class="mdui-grid-tile-title">龙之叶</div>
        <div class="mdui-grid-tile-subtitle"><i class="mdui-icon material-icons">art_track</i>生命不息，折腾不止</div>
      </div>
      
        <div class="mdui-grid-tile-buttons">
          <a href="mailto:longzhiye163@163.com" class="mdui-btn mdui-btn-icon" mdui-tooltip="{content: 'longzhiye163@163.com'}"><i class="mdui-icon material-icons">email</i></a>
        </div>
      
    </div>
  </div>

  <div class="mdui-list" mdui-collapse="{accordion: true}">
    <a href="/" class="mdui-list-item mdui-ripple">
      <i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-blue">home</i>
      <div class="mdui-list-item-content">主页</div>
    </a>
    <div class="mdui-collapse-item">
      <script>var a=localStorage.getItem("mdui-collapse-item-0");if(a){document.getElementsByClassName("mdui-collapse-item")[0].className+=" mdui-collapse-item-open"};</script>
      <div class="mdui-collapse-item-header mdui-list-item mdui-ripple">
        <i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-deep-orange">archive</i>
        <div class="mdui-list-item-content">归档</div>
        <i class="mdui-collapse-item-arrow mdui-icon material-icons">keyboard_arrow_down</i>
      </div>
      <div class="mdui-collapse-item-body mdui-list mdui-list-dense">
        
        <a class="mdui-ripple sidebar_archives-link" href="/archives/2025/07/">七月 2025<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2025/06/">六月 2025<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2025/03/">三月 2025<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2025/02/">二月 2025<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2025/01/">一月 2025<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2024/10/">十月 2024<span class="mdui-ripple sidebar_archives-count">7</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2024/09/">九月 2024<span class="mdui-ripple sidebar_archives-count">4</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2024/08/">八月 2024<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2024/03/">三月 2024<span class="mdui-ripple sidebar_archives-count">5</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2024/02/">二月 2024<span class="mdui-ripple sidebar_archives-count">11</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2024/01/">一月 2024<span class="mdui-ripple sidebar_archives-count">9</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2023/12/">十二月 2023<span class="mdui-ripple sidebar_archives-count">10</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2023/11/">十一月 2023<span class="mdui-ripple sidebar_archives-count">8</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2023/10/">十月 2023<span class="mdui-ripple sidebar_archives-count">8</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2023/09/">九月 2023<span class="mdui-ripple sidebar_archives-count">3</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2023/08/">八月 2023<span class="mdui-ripple sidebar_archives-count">6</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2023/06/">六月 2023<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2023/05/">五月 2023<span class="mdui-ripple sidebar_archives-count">4</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2023/04/">四月 2023<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2023/03/">三月 2023<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2023/02/">二月 2023<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2022/09/">九月 2022<span class="mdui-ripple sidebar_archives-count">7</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2022/08/">八月 2022<span class="mdui-ripple sidebar_archives-count">4</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2017/04/">四月 2017<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2017/03/">三月 2017<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2017/02/">二月 2017<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2017/01/">一月 2017<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2016/12/">十二月 2016<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2016/11/">十一月 2016<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2016/10/">十月 2016<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/archives/2016/08/">八月 2016<span class="mdui-ripple sidebar_archives-count">1</span></a>
        
      </div>
    </div>
    <div class="mdui-collapse-item">
      <script>var a=localStorage.getItem("mdui-collapse-item-1");if(a){document.getElementsByClassName("mdui-collapse-item")[1].className+=" mdui-collapse-item-open"};</script>
      <div class="mdui-collapse-item-header mdui-list-item mdui-ripple">
        <i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-green">class</i>
        <div class="mdui-list-item-content">分类</div>
        <i class="mdui-collapse-item-arrow mdui-icon material-icons">keyboard_arrow_down</i>
      </div>
      <div class="mdui-collapse-item-body mdui-list mdui-list-dense">
        
        <a class="mdui-ripple sidebar_archives-link" href="/categories/%E6%8A%80%E6%9C%AF/">技术<span class="mdui-ripple sidebar_archives-count">98</span></a><a class="mdui-ripple sidebar_archives-link" href="/categories/%E7%94%9F%E6%B4%BB/">生活<span class="mdui-ripple sidebar_archives-count">3</span></a><a class="mdui-ripple sidebar_archives-link" href="/categories/%E8%B5%84%E8%AE%AF/">资讯<span class="mdui-ripple sidebar_archives-count">4</span></a><a class="mdui-ripple sidebar_archives-link" href="/categories/%E9%80%9A%E7%9F%A5/">通知<span class="mdui-ripple sidebar_archives-count">4</span></a>
        
      </div>
    </div>
    <div class="mdui-collapse-item">
      <script>var a=localStorage.getItem("mdui-collapse-item-2");if(a){document.getElementsByClassName("mdui-collapse-item")[2].className+=" mdui-collapse-item-open"};</script>
      <div class="mdui-collapse-item-header mdui-list-item mdui-ripple">
        <i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-brown">bookmark</i>
        <div class="mdui-list-item-content">标签</div>
        <i class="mdui-collapse-item-arrow mdui-icon material-icons">keyboard_arrow_down</i>
      </div>
      <div class="mdui-collapse-item-body mdui-list mdui-list-dense">
        
        <a class="mdui-ripple sidebar_archives-link" href="/tags/ANR/" rel="tag">ANR<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/APP/" rel="tag">APP<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Android/" rel="tag">Android<span class="mdui-ripple sidebar_archives-count">89</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Android12/" rel="tag">Android12<span class="mdui-ripple sidebar_archives-count">3</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Android13/" rel="tag">Android13<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Android14/" rel="tag">Android14<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/AndroidStudio/" rel="tag">AndroidStudio<span class="mdui-ripple sidebar_archives-count">3</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/AutoDraw/" rel="tag">AutoDraw<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Crash/" rel="tag">Crash<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Foxmail/" rel="tag">Foxmail<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Framework/" rel="tag">Framework<span class="mdui-ripple sidebar_archives-count">20</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/GPS%E8%BD%A8%E8%BF%B9%E5%9B%BE/" rel="tag">GPS轨迹图<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Git/" rel="tag">Git<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/GitHub/" rel="tag">GitHub<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Google/" rel="tag">Google<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Hexo/" rel="tag">Hexo<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Java/" rel="tag">Java<span class="mdui-ripple sidebar_archives-count">3</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Kernel/" rel="tag">Kernel<span class="mdui-ripple sidebar_archives-count">4</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Launcher/" rel="tag">Launcher<span class="mdui-ripple sidebar_archives-count">17</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Lib/" rel="tag">Lib<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Linux/" rel="tag">Linux<span class="mdui-ripple sidebar_archives-count">18</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Markdown/" rel="tag">Markdown<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Material-Design/" rel="tag">Material Design<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/OS-X/" rel="tag">OS X<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/OTA/" rel="tag">OTA<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/QuickTime/" rel="tag">QuickTime<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/SSH/" rel="tag">SSH<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Settings/" rel="tag">Settings<span class="mdui-ripple sidebar_archives-count">6</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/SystemUI/" rel="tag">SystemUI<span class="mdui-ripple sidebar_archives-count">19</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Ubuntu/" rel="tag">Ubuntu<span class="mdui-ripple sidebar_archives-count">7</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/WPS/" rel="tag">WPS<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Wifi/" rel="tag">Wifi<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/WindTerm/" rel="tag">WindTerm<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/Windows/" rel="tag">Windows<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/androidmk/" rel="tag">androidmk<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/blog/" rel="tag">blog<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/build/" rel="tag">build<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/feel/" rel="tag">feel<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/framework/" rel="tag">framework<span class="mdui-ripple sidebar_archives-count">50</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/git/" rel="tag">git<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/inotify/" rel="tag">inotify<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/life/" rel="tag">life<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/ninja/" rel="tag">ninja<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/rsync/" rel="tag">rsync<span class="mdui-ripple sidebar_archives-count">2</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/standard/" rel="tag">standard<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/test/" rel="tag">test<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1/" rel="tag">企业微信<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/" rel="tag">操作系统<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/%E6%B5%8B%E8%AF%95/" rel="tag">测试<span class="mdui-ripple sidebar_archives-count">1</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/%E6%BA%90%E7%A0%81/" rel="tag">源码<span class="mdui-ripple sidebar_archives-count">3</span></a><a class="mdui-ripple sidebar_archives-link" href="/tags/%E7%94%9F%E6%B4%BB%E6%84%9F%E6%82%9F/" rel="tag">生活感悟<span class="mdui-ripple sidebar_archives-count">1</span></a>
        
      </div>
    </div>
    <a href="/about" class="mdui-list-item mdui-ripple">
      <i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-purple">person</i>
      <div class="mdui-list-item-content">关于</div>
    </a>
  </div>

  <div class="mdui-divider"></div>

  <div class="mdui-list" mdui-collapse="{accordion: true}">
    
      <a href="/timeline" class="mdui-list-item mdui-ripple">时间轴</a>
    
    <div class="mdui-collapse-item">
      <script>var a=localStorage.getItem("mdui-collapse-item-3");if(a){document.getElementsByClassName("mdui-collapse-item")[3].className+=" mdui-collapse-item-open"};</script>
      <div class="mdui-collapse-item-header mdui-list-item mdui-ripple">
        <div class="mdui-list-item-content">友情链接</div>
        <i class="mdui-list-item-icon mdui-icon material-icons">link</i>
      </div>
      <div class="mdui-collapse-item-body mdui-list mdui-list-dense">
        
          <a href="http://www.niemingzhao.top" target="_blank" class="mdui-list-item mdui-p-l-2 mdui-text-color-theme-accent mdui-ripple" style="justify-content: center;">聂明照的博客</a>
        
        
      </div>
    </div>
  </div>
</aside>

  <main id="main" class="mdui-m-t-5 fadeIn animated">
  
<link rel="stylesheet" href="//cdn.bootcdn.net/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css">

  <style>#main article .mdui-card-content .center-block{display:block!important;margin-right:auto!important;margin-left:auto!important}</style>
  <style>#main article .mdui-card-content .text-center{text-align:center!important}</style>
  <article class="mdui-card mdui-m-b-5">
    <header class="mdui-card-media">
      <img src="/images/random/material-13.png" style="max-height: 240px;">
      <div class="mdui-card-media-covered">
        <div class="mdui-card-primary">
          <div class="mdui-card-primary-title">Android10源码刷入Pixel2以及整合GMS</div>
          <div class="mdui-card-primary-subtitle"><i class="iconfont">&#xe697;</i> 2023-08-27 / <i class="iconfont">&#xe601;</i> 龙之叶 &nbsp;&nbsp; <span id="busuanzi_container_page_pv" style="display: none;"><i class="iconfont">&#xe7fd;</i> <span id="busuanzi_value_page_pv"></span></span></div>
        </div>
      </div>
      <div class="mdui-card-menu">
        
          <button class="mdui-btn mdui-btn-icon mdui-text-color-white" mdui-menu="{target: '#qrcode', align: 'right'}"><i class="mdui-icon material-icons">devices</i></button>
          <ul class="mdui-menu" id="qrcode">
            
              <li class="mdui-menu-item"><a class="mdui-text-center mdui-ripple">发送到手机</a></li>
            
            <li class="mdui-menu-item" disabled>
              
                <img src="//qr.liantu.com/api.php?w=246&m=10&text=http://longzhiye.top/2023/08/27/2023-08-27/">
              
            </li>
          </ul>
        
        
          <button class="mdui-btn mdui-btn-icon mdui-text-color-white" mdui-menu="{target: '#share_menu', align: 'right'}"><i class="mdui-icon material-icons">share</i></button>
          <ul class="mdui-menu" id="share_menu">
            <li class="mdui-menu-item">
              <a href="https://service.weibo.com/share/share.php?appkey=&title=Android10源码刷入Pixel2以及整合GMS&url=http://longzhiye.top/2023/08/27/2023-08-27/&pic=http://longzhiye.top/images/favicon.png&searchPic=false&style=simple" target="_blank" class="mdui-ripple">分享到 Weibo</a>
            </li>
            <li class="mdui-menu-item">
              <a href="https://twitter.com/intent/tweet?text=Android10源码刷入Pixel2以及整合GMS&url=http://longzhiye.top/2023/08/27/2023-08-27/&via=龙之叶" target="_blank" class="mdui-ripple">分享到 Twitter</a>
            </li>
            <li class="mdui-menu-item">
              <a href="https://www.facebook.com/sharer/sharer.php?u=http://longzhiye.top/2023/08/27/2023-08-27/" target="_blank" class="mdui-ripple">分享到 Facebook</a>
            </li>
            <li class="mdui-menu-item">
              <a href="https://plus.google.com/share?url=http://longzhiye.top/2023/08/27/2023-08-27/" target="_blank" class="mdui-ripple">分享到 Google+</a>
            </li>
            <li class="mdui-menu-item">
              <a href="https://www.linkedin.com/shareArticle?mini=true&url=http://longzhiye.top/2023/08/27/2023-08-27/&title=Android10源码刷入Pixel2以及整合GMS" target="_blank" class="mdui-ripple">分享到 LinkedIn</a>
            </li>
            <li class="mdui-menu-item">
              <a href="https://connect.qq.com/widget/shareqq/index.html?site=龙之叶的博客&title=Android10源码刷入Pixel2以及整合GMS&pics=http://longzhiye.top/images/favicon.png&url=http://longzhiye.top/2023/08/27/2023-08-27/" target="_blank" class="mdui-ripple">分享到 QQ</a>
            </li>
            <li class="mdui-menu-item">
              <a href="https://telegram.me/share/url?url=http://longzhiye.top/2023/08/27/2023-08-27/&text=Android10源码刷入Pixel2以及整合GMS" target="_blank" class="mdui-ripple">分享到 Telegram</a>
            </li>
          </ul>
        
      </div>
    </header>
    <div class="mdui-card-content mdui-typo">
      <h2 id="一、ASOP源码下载"><a href="#一、ASOP源码下载" class="headerlink" title="一、ASOP源码下载"></a>一、ASOP源码下载</h2><p>具体可以参考我之前发布的文章</p>
<h2 id="二、下载相关驱动包"><a href="#二、下载相关驱动包" class="headerlink" title="二、下载相关驱动包"></a>二、下载相关驱动包</h2><p>这一步很关键，关系到编译后的镜像能否刷入后运行</p>
<p>下载链接：<a target="_blank" rel="noopener" href="https://developers.google.com/android/drivers">Nexus 和 Pixel 设备的驱动程序二进制文件</a></p>
<p><img src="/images/20230827/20230827150006.png"></p>
<p>如下图所示，将两个驱动程序上传到Ubuntu服务器，并进行解压，得到两个脚本：</p>
<p><img src="/images/20230827/202308271401001.jpg"></p>
<p>下载解压后会有两个脚本文件，运行后输入I ACCEPT就会得到一个vendor文件夹的文件夹</p>
<h2 id="三、AOSP源码编译"><a href="#三、AOSP源码编译" class="headerlink" title="三、AOSP源码编译"></a>三、AOSP源码编译</h2><p>首先加载配置文件，然后选择机型</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">source build/envsetup.sh</span><br><span class="line">lunch aosp_walleye-userdebug</span><br></pre></td></tr></table></figure>
<p>这里直接输入lunch就能看到可以编译的全部机型，然后选择对应的机型就行</p>
<p>然后就直接</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">make -j6</span><br></pre></td></tr></table></figure>
<p>如果期间有什么报错可以百度，修复后，直接make -j6继续运行就行。</p>
<p>经过漫长的等待，6个小时，终于成功了</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">[ 99% 101428/101980] //art/build/apex:art-check-debug-apex-gen generate art-check-debug-apex-gen.dummy</span><br><span class="line">--bitness=auto, trying to autodetect. This may be incorrect!</span><br><span class="line">  Detected multilib</span><br><span class="line"><span class="meta prompt_">[100% </span><span class="language-bash">101980/101980] Target vbmeta image: out/target/product/walleye/vbmeta.img</span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash"><span class="comment">### build completed successfully (05:52:50 (hh:mm:ss)) ####</span></span></span><br></pre></td></tr></table></figure>
<p>编译之后的输入镜像文件，其所在路径为”/out/target/product/walleye”</p>
<h2 id="四、刷入镜像"><a href="#四、刷入镜像" class="headerlink" title="四、刷入镜像"></a>四、刷入镜像</h2><h3 id="1-打开OEM开关"><a href="#1-打开OEM开关" class="headerlink" title="1.打开OEM开关"></a>1.打开OEM开关</h3><p>先点击设置—关于手机—-版本号七次—开发者选项—打开OEM解锁（这步必须可以上网，否则打不开）</p>
<h3 id="2-启动进入fastboot模式"><a href="#2-启动进入fastboot模式" class="headerlink" title="2.启动进入fastboot模式"></a>2.启动进入fastboot模式</h3><p>方法1：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">adb reboot bootloader</span><br></pre></td></tr></table></figure>
<p>方法2:<br>使用下图的快捷键，我的手机Pixel2 就是音量减键和电源键<br><img src="/images/20230827/20230827T07-34-57.146Z.png"></p>
<p>成功fastboot模式进入，如下图：<br><img src="/images/20230827/202308271401002.jpg"></p>
<h3 id="3-解锁手机"><a href="#3-解锁手机" class="headerlink" title="3.解锁手机"></a>3.解锁手机</h3><p>对于新款设备（2015 年及之后发布的设备）</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fastboot flashing unlock</span><br></pre></td></tr></table></figure>
<p>对于老款设备（2014 年及之前发布的设备）</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fastboot oem unlock</span><br></pre></td></tr></table></figure>
<p>解锁确认界面，如下图：<br><img src="/images/20230827/202308271401003.jpg"></p>
<h3 id="4-刷机"><a href="#4-刷机" class="headerlink" title="4.刷机"></a>4.刷机</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd out/target/product/walleye</span><br><span class="line">fastboot flashall -w</span><br></pre></td></tr></table></figure>
<p>成功进入桌面，如下图：<br><img src="/images/20230827/202308271401004.jpg"></p>
<h3 id="5-windows挂载-Ubuntu服务器的情况"><a href="#5-windows挂载-Ubuntu服务器的情况" class="headerlink" title="5.windows挂载 Ubuntu服务器的情况"></a>5.windows挂载 Ubuntu服务器的情况</h3><p>在进行刷机时，需要设置环境变量ANDROID_PRODUCT_OUT。 如果是windows 需要指向其编译机器下的镜像输出目录。要想实现共享，需要在Ubuntu Server上安装和配置samba服务器。<br>1.在windows中，将服务器编译输出目录，映射为本地文件夹，编译访问<br>2.设置Windows环境变量<br><img src="/images/20230827/20230831150007.jpg"></p>
<h3 id="5-刷入部分镜像"><a href="#5-刷入部分镜像" class="headerlink" title="5.刷入部分镜像"></a>5.刷入部分镜像</h3><p>由于常常修改的都是System镜像部分内容，但是编译出来的System有两个部分system.img和system_other.img使用这里就讲一讲System一个如何单独刷入进去。</p>
<p>于Android8之后采用A/B更新, 所以有2套分区, 刷分区方式和以往不同:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">fastboot flash system system.img</span><br><span class="line">fastboot flash system_a system_other.img</span><br><span class="line">fastboot set_active b</span><br><span class="line">fastboot reboot</span><br></pre></td></tr></table></figure>

<h2 id="五、添加GMS服务"><a href="#五、添加GMS服务" class="headerlink" title="五、添加GMS服务"></a>五、添加GMS服务</h2><p>GMS是Google Map/Chrome/Youtube等Google软件，是Google私有的套件。只有与Google签订合同的手机厂商可以预加载GMS。因此，虽然我们编译AOSP是Android官方发布，但不会包含GMS预加载。<br>理论上，Google为了同时保持开放性和服务可靠性，可以说是放水了。它让解锁后的手机可以安装GMS到Android系统。而重点是“解锁后”，所以Google不会告你侵权，只要不是预装在市售ROM就可以。于是<strong>Open GAPP</strong>计划就产生了，它让第三方ROM可以使用GMS及其服务。<a target="_blank" rel="noopener" href="https://opengapps.org/">Open Gapps官网</a><br>OpenGapps也有教你如何把GMS整合进整个源代码<a target="_blank" rel="noopener" href="https://github.com/opengapps/aosp_build">https://github.com/opengapps/aosp_build</a></p>
<h3 id="1-修改manifest-xml"><a href="#1-修改manifest-xml" class="headerlink" title="1.修改manifest.xml"></a>1.修改manifest.xml</h3><p>找到你的清单文件.repo\manifests\default.xml，并在末尾添加以下内容:</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;opengapps&quot;</span> <span class="attr">fetch</span>=<span class="string">&quot;https://github.com/opengapps/&quot;</span>  /&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;opengapps-gitlab&quot;</span> <span class="attr">fetch</span>=<span class="string">&quot;https://gitlab.opengapps.org/opengapps/&quot;</span>  /&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;vendor/opengapps/build&quot;</span> <span class="attr">name</span>=<span class="string">&quot;aosp_build&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;opengapps&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;vendor/opengapps/sources/all&quot;</span> <span class="attr">name</span>=<span class="string">&quot;all&quot;</span> <span class="attr">clone-depth</span>=<span class="string">&quot;1&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;opengapps-gitlab&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">&lt;!-- arm64 depends on arm --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;vendor/opengapps/sources/arm&quot;</span> <span class="attr">name</span>=<span class="string">&quot;arm&quot;</span> <span class="attr">clone-depth</span>=<span class="string">&quot;1&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;opengapps-gitlab&quot;</span> /&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;vendor/opengapps/sources/arm64&quot;</span> <span class="attr">name</span>=<span class="string">&quot;arm64&quot;</span> <span class="attr">clone-depth</span>=<span class="string">&quot;1&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;opengapps-gitlab&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;vendor/opengapps/sources/x86&quot;</span> <span class="attr">name</span>=<span class="string">&quot;x86&quot;</span> <span class="attr">clone-depth</span>=<span class="string">&quot;1&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;opengapps-gitlab&quot;</span> /&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;vendor/opengapps/sources/x86_64&quot;</span> <span class="attr">name</span>=<span class="string">&quot;x86_64&quot;</span> <span class="attr">clone-depth</span>=<span class="string">&quot;1&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;opengapps-gitlab&quot;</span> /&gt;</span></span><br></pre></td></tr></table></figure>
<h3 id="2-设置所需的OpenGapps变体"><a href="#2-设置所需的OpenGapps变体" class="headerlink" title="2. 设置所需的OpenGapps变体"></a>2. 设置所需的OpenGapps变体</h3><p>修改文件：<strong>device/google/muskie/aosp_walleye.mk</strong>，将：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">PRODUCT_RESTRICT_VENDOR_FILES := owner</span><br></pre></td></tr></table></figure>
<p>该为</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">PRODUCT_RESTRICT_VENDOR_FILES := false</span><br></pre></td></tr></table></figure>
<p>否则在编译时会发生错误:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">error: Error: Product &quot;aosp_walleye&quot; cannot have overlay in vendor tree:...</span><br></pre></td></tr></table></figure>
<p>再修改文件：<strong>device/google/wahoo/device.mk</strong>，在文件最后加入</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">GAPPS_VARIANT := stock</span><br><span class="line">$(call inherit-product, vendor/opengapps/build/opengapps-packages.mk)</span><br></pre></td></tr></table></figure>
<p>编译AOSP时，就会相应vendor/opengapps/build/opengapps-packages.mk将Open Gapps编入system.img中</p>
<h3 id="3-修改原始代码"><a href="#3-修改原始代码" class="headerlink" title="3.修改原始代码"></a>3.修改原始代码</h3><p>修改<strong>frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java</strong></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">--- a/services/core/java/com/android/server/wm/WindowManagerService.java</span><br><span class="line">+++ b/services/core/java/com/android/server/wm/WindowManagerService.java</span><br><span class="line">@@ -<span class="number">6001</span>,<span class="number">8</span> +<span class="number">6001</span>,<span class="number">8</span> @@ <span class="keyword">public</span> <span class="keyword">class</span> <span class="title class_">WindowManagerService</span> <span class="keyword">extends</span> <span class="title class_">IWindowManager</span>.Stub</span><br><span class="line"> </span><br><span class="line">     <span class="meta">@Override</span></span><br><span class="line">     <span class="keyword">public</span> <span class="keyword">void</span> <span class="title function_">setShelfHeight</span><span class="params">(<span class="type">boolean</span> visible, <span class="type">int</span> shelfHeight)</span> &#123;</span><br><span class="line">-        mAmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR,</span><br><span class="line">-                <span class="string">&quot;setShelfHeight()&quot;</span>);</span><br><span class="line">+        <span class="comment">//mAmInternal.enforceCallerIsRecentsOrHasPermission(android.Manifest.permission.STATUS_BAR,</span></span><br><span class="line">+        <span class="comment">//        &quot;setShelfHeight()&quot;);</span></span><br><span class="line">         <span class="keyword">synchronized</span> (mWindowMap) &#123;</span><br><span class="line">             getDefaultDisplayContentLocked().getPinnedStackController().setAdjustedForShelf(visible,</span><br><span class="line">                     shelfHeight)</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>把setShelfHeight所需要的权限移除，否则刷入ROM之后Pixel Launcher会因权限不足发生错误。</p>
<h3 id="4-安装git-LFS并拉入所有依赖项"><a href="#4-安装git-LFS并拉入所有依赖项" class="headerlink" title="4.安装git LFS并拉入所有依赖项"></a>4.安装git LFS并拉入所有依赖项</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install git-lfs</span><br><span class="line">git lfs install</span><br><span class="line">repo forall -c git lfs pull</span><br></pre></td></tr></table></figure>
<p>国内因为网络问题，建议将源换成Gitee，重新拉取代码<br>.repo\manifests\default.xml</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">&lt;remote name=&quot;opengapps&quot; fetch=&quot;https://gitee.com/mirrors_opengapps&quot;  /&gt;</span><br><span class="line">&lt;remote name=&quot;opengapps-gitlab&quot; fetch=&quot;https://gitlab.opengapps.org/opengapps/&quot;  /&gt;</span><br><span class="line">&lt;project path=&quot;vendor/opengapps/build&quot; name=&quot;aosp_build&quot; revision=&quot;master&quot; remote=&quot;opengapps&quot; /&gt;</span><br><span class="line">&lt;project path=&quot;vendor/opengapps/sources/all&quot; name=&quot;all&quot; clone-depth=&quot;1&quot; revision=&quot;master&quot; remote=&quot;opengapps-gitlab&quot; /&gt;</span><br><span class="line">&lt;!-- arm64 depends on arm --&gt;</span><br><span class="line">&lt;project path=&quot;vendor/opengapps/sources/arm&quot; name=&quot;arm&quot; clone-depth=&quot;1&quot; revision=&quot;master&quot; remote=&quot;opengapps-gitlab&quot; /&gt;</span><br><span class="line">&lt;project path=&quot;vendor/opengapps/sources/arm64&quot; name=&quot;arm64&quot; clone-depth=&quot;1&quot; revision=&quot;master&quot; remote=&quot;opengapps-gitlab&quot; /&gt;</span><br><span class="line">&lt;project path=&quot;vendor/opengapps/sources/x86&quot; name=&quot;x86&quot; clone-depth=&quot;1&quot; revision=&quot;master&quot; remote=&quot;opengapps-gitlab&quot; /&gt;</span><br><span class="line">&lt;project path=&quot;vendor/opengapps/sources/x86_64&quot; name=&quot;x86_64&quot; clone-depth=&quot;1&quot; revision=&quot;master&quot; remote=&quot;opengapps-gitlab&quot; /&gt;</span><br></pre></td></tr></table></figure>
<p>手动同步下，取决于你的网络，大约要下载20GB的文件</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd /vendor/opengapps/sources</span><br><span class="line">for d in ./*/ ; do (cd &quot;$d&quot; &amp;&amp; git lfs pull); done</span><br></pre></td></tr></table></figure>
<p>最后别忘了重新同步下仓库</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">repo sync -c</span><br></pre></td></tr></table></figure>

<h3 id="5-重新编译及刷机"><a href="#5-重新编译及刷机" class="headerlink" title="5.重新编译及刷机"></a>5.重新编译及刷机</h3><p>再下make之后，重新刷机，结果如下：<br><img src="/images/20230827/202308271401005.jpg"></p>
<h2 id="六、可以会遇到的问题"><a href="#六、可以会遇到的问题" class="headerlink" title="六、可以会遇到的问题"></a>六、可以会遇到的问题</h2><p>问题：<br>__populate_fs: Could not allocate block in ext2 filesystem while writing file “libLLVM_android.so”<br>e2fsdroid: Could not allocate block in ext2 filesystem while populating file system<br>解决：<br>从提示的错误来看，应该是编译设置中分配给systemimage的镜像太小的问题<br>找到设置的文件：device/XXX/XXX_common/BoardConfig.mk,pixel2的路径为”\device\google\wahoo\BoardConfig.mk”<br>修改BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2684354560为BOARD_SYSTEMIMAGE_PARTITION_SIZE := 4026531840</p>
<p>问题：<br>执行<strong>fastboot flashall -w</strong>时<br>Sending sparse ‘system_a’ 1/3 (519292 KB)          OKAY [ 45.361s]<br>Writing ‘system_a’                                 OKAY [  0.001s]<br>Sending sparse ‘system_a’ 2/3 (522280 KB)          FAILED (remote: ‘Error flashing partition.’)<br>fastboot: error: Command failed<br>解决：<br>刷机包不完整，仓库更新以后之后手动同步下repo sync仓库后全编再试</p>
<h2 id="附录：编译后各个镜像的功能介绍"><a href="#附录：编译后各个镜像的功能介绍" class="headerlink" title="附录：编译后各个镜像的功能介绍"></a>附录：编译后各个镜像的功能介绍</h2><table>
<thead>
<tr>
<th>名称</th>
<th>作用</th>
</tr>
</thead>
<tbody><tr>
<td>ramdisk.img</td>
<td>ramdisk 为内存文件系统，是一个最小型文件系统， 在内核启动的时候会将其作为根文件系统进行挂，文件实际为 gzip 文件，可以直接解压</td>
</tr>
<tr>
<td>boot.img</td>
<td>boot.img 包含内 Linux 内核镜像 zImage 和根文件系统 ramdisk 文件,镜像基本构成为：头部，内核，ramdisk 镜像</td>
</tr>
<tr>
<td>dtbo.img</td>
<td>dtb overlay, 叠加 DT。由原始设计制造商 (ODM)/原始设备制造商 (OEM) 提供的设备专用配置</td>
</tr>
<tr>
<td>system.img</td>
<td>system 镜像会提供 android 所需要的命令，内置 app，运行动态库，以及系统配置文件， 在system-as-root特性中， system 镜像会被直接挂载成根目录下。</td>
</tr>
<tr>
<td>vendor.img/odm.img/oem.img/product.img</td>
<td>包含有厂商私有的可执行程序、库、系统服务和 app 等。可以将此分区看做是 system 分区的补充，厂商定制 ROM 的一些功能都可以放在此分区，odm 是贴牌厂商定制镜像， oem 是代工厂商定制镜像，</td>
</tr>
<tr>
<td>super.img</td>
<td>自 Android Q(10.0)以后，系统支持动态分区（dynamic partition），它将多个系统只读分区（包括 system、product、vendor、odm 或者其他厂商自定义分区）合并为一个 super 分区。物理分区只有 super 分区的概念，而没有 system等分区</td>
</tr>
<tr>
<td>userdata.img</td>
<td>用户存储空间。一般新买来的手机此分区几乎是空的，用户安装的 app 以及用户数据都是存放在此分区中。用户通过系统文件管理器访问到的手机存储（sdcard）即此分区的一部分，是通过 fuse 或 sdcardfs 这类用户态文件系统实现的一块特殊存储空间。</td>
</tr>
<tr>
<td>vbmeta.img</td>
<td>验证启动（Verified Boot）是 Android 4.4 开始引入的一个新的安全功能，作用是在系统启动时校验分区是否被篡改或者发生过改动，比如用户使用 root 软件强行植入 su 文件，但最后删除了 su， 这种情况也能检测出来。一旦检验不过，系统就不能正常启动，并且有相关的图文提示， 简单描述做法就是在启动过程中增加一条校验链，即 ROM code 校验 BootLoader，确保 BootLoader 的合法性和完整性，BootLoader 则需要校验 bootimage，确保 Kernel 启动所需 image 的合法性和完整性，而 Kernel 则负责校验 System 分区和 vendor 分区。</td>
</tr>
<tr>
<td>recovery.img</td>
<td>recovery 分区的镜像，一般用作系统恢复和升级，在 A/B 设备中，升级就不放在 recovery 中了。包含 recovery系统的 kernel 和 ramdisk。如果 bootloader 选择启动 recovery 模式，则会引导启动此分区的 kernel 并加载 ramdisk，并启动其中的 init 继而启动 recovery 程序，至此可以操作 recovery 模式功能（主要包括 OTA 升级、双清等）。boot.img 中 ramdisk 里 的 init.rc 位 于system/core/init/init.rc, 而 recovery.img 中 ramdisk 里 的 init.rc 位 于bootable/recovery/etc/init.rc</td>
</tr>
<tr>
<td>cache.img</td>
<td>主要用于缓存系统升级 OTA 包等。双清就是指对 userdata 分区和 cache 分区的清理。在 A/B 设备中，OTA 包就不需要存储在此。</td>
</tr>
</tbody></table>

      
      <blockquote>
        
        <strong>本文链接：</strong><br><a href="http://longzhiye.top/2023/08/27/2023-08-27/">http://longzhiye.top/2023/08/27/2023-08-27/</a>
      </blockquote>
    </div>
    <footer class="mdui-card-actions">
      
        <a class="mdui-ripple article_categories-link" href="/categories/%E6%8A%80%E6%9C%AF/">技术</a>
      
      
        <a class="mdui-ripple article_tags-link" href="/tags/Android/" rel="tag">Android</a><a class="mdui-ripple article_tags-link" href="/tags/Linux/" rel="tag">Linux</a><a class="mdui-ripple article_tags-link" href="/tags/Ubuntu/" rel="tag">Ubuntu</a>
      
    </footer>
    
  </article>
  
<script src="//cdn.bootcdn.net/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="//cdn.bootcdn.net/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js"></script>

  <script>$("#main article .mdui-card-content img.fancybox").on("click",function(e){$.fancybox.open({src:$(this).attr("src")});});</script>


  <nav id="paginator">
    
      <a rel="prev" class="extend prev" href="/2023/09/02/2023-09-02/">
        <button aria-label="prev" class="mdui-btn mdui-btn-raised mdui-btn-icon mdui-color-theme-accent mdui-ripple"><i class="mdui-icon material-icons">arrow_back</i></button>
        <span class="mdui-p-x-3" mdui-tooltip="{content: 'android 10 user版本默认打开usb调试'}">上一篇</span>
      </a>
    
    <div class="spacer"></div>
    
      <a rel="next" class="extend next" href="/2023/08/26/2023-08-26/">
        <span class="mdui-p-x-3" mdui-tooltip="{content: 'Android源码编译命令详解'}">下一篇</span>
        <button aria-label="next" class="mdui-btn mdui-btn-raised mdui-btn-icon mdui-color-theme-accent mdui-ripple"><i class="mdui-icon material-icons">arrow_forward</i></button>
      </a>
    
  </nav>





</main>
  <footer id="footer" class="mdui-m-t-5 mdui-p-y-3 mdui-color-theme">
  <div class="mdui-p-y-0 mdui-text-center">
    
    
    
    
    
    
    
      <a href="http://github.com/longzhiye" target="_blank" class="mdui-btn mdui-btn-icon mdui-text-color-theme-a100"><i class="mdui-icon iconfont">&#xe7ab;</i></a>
    
    
    
      <a href="https://www.zhihu.com/people/long-zhi-xie-61" target="_blank" class="mdui-btn mdui-btn-icon mdui-text-color-theme-a100"><i class="mdui-icon iconfont">&#xe6c0;</i></a>
    
    
    
      <a href="tencent://tencent:////message/?uin=951898105&Menu=yes" target="_blank" class="mdui-btn mdui-btn-icon mdui-text-color-theme-a100"><i class="mdui-icon iconfont">&#xe651;</i></a>
    
    
  </div>
  <div class="mdui-p-y-1 mdui-text-center">
    Copyright &copy; 2022 - 2025 龙之叶<br>
    Powered by <a href="https://hexo.io/" target="_blank" class="mdui-text-color-theme-accent">Hexo</a>
    <br>
      <span id="busuanzi_container_site_pv" style="display: none;"><i class="iconfont">&#xe7fd;</i> <span id="busuanzi_value_site_pv"></span></span> &nbsp;&nbsp;
      <span id="busuanzi_container_site_uv" style="display: none;"><i class="iconfont">&#xe601;</i> <span id="busuanzi_value_site_uv"></span></span>
    
  </div>
</footer>

  <button id="gotop" class="mdui-fab mdui-fab-fixed mdui-fab-hide mdui-color-theme-accent mdui-ripple"><i class="mdui-icon material-icons">arrow_upward</i></button>
  <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
  
<script src="/js/mdui.js"></script>
<script src="/js/script.js"></script>

  
<script src="/custom.js"></script>

</body>
</html>
